import ajax from './ajax';
import mockAjax from './mockAjax';

export const reqCategoryListDate = () => ajax.get('/product/getBaseCategoryList');
export const reqGetBannerListData = () => mockAjax.get('/bannerList');
//获取楼层数据
export const reqGetFloorsListData = ()=> mockAjax.get('/floorsList')
//获取数据  这个不是List 因为不是数组 是一个对象
export const reqGetSearchGoodsInfoData = (searchParams) => ajax.post('/list', searchParams);

//  获取商品详情数据
export const reqGoodsDetailInfoData = (id) => ajax.get('/item/' + id);

//  添加商品到购物车或是更新购物车
export const reqAddOrUpdateCart = (skuId, skuNum) => ajax.post(`/cart/addToCart/${skuId}/${skuNum}`);

//  添加到购物车
export const reqChangeShopCartInfoState = (skuId, skuNum) => ajax.post(`/cart/addToCart/${skuId}/${skuNum}`);

//  发送请求获取购物车中的商品数据
export const reqShopCartListData = () => ajax.get('/cart/cartList');

//  更新购物车中数据的选中状态
export const reqChangeAllCartState = (isChecked, skuIdList) =>
  ajax({
    url: `/cart/batchCheckCart/${isChecked}`,
    method: 'post',
    data: skuIdList
  })
//  删除购物车中的一条商品数据
export const reqDelOneShopCartInfo = skuId => ajax.delete(`/cart/deleteCart/${skuId}`);
export const reqDelSelectedShopCartInfo = skuIdList => ajax.post('/cart/batchDeleteCart', skuIdList);

//  批量删除商品
export const reqDelSelectedCartInfo = skuIdList => ajax.post(`/cart/batchDeleteCart`, skuIdList);
// 获取trade页面中的数据
export const reqGetTradeListData = () => ajax.get('/order/auth/trade');

// 获取手机验证码
export const reqVerifyCode = phone => ajax.get(`/user/passport/sendCode/${phone}`);

// 注册账号
export const reqUserRegister = user => ajax.post('/user/passport/register', user);

// 实现登陆
export const reqUserLogin = (user) => ajax.post('/user/passport/login', user);

// 用户退出
export const reqUserLogout = () => ajax.get('/user/passport/logout');

// 获取邮寄地址
export const reqUserAddressList = ()=> ajax.get('/user/userAddress/auth/findUserAddressList')

//获取订单交易页数据
export const reqTradeInfoData = () => ajax.get('/order/auth/trade');

// 提交订单
export const reqSubmitTradeOrder = (tradeNo, params) => ajax.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, params);

// 获得订单支付信息  也就是获取支付二维码
export const reqGetPayQRcode = (orderId) => ajax.get(`/payment/weixin/createNative/${orderId}`);

// 查询支付的订单状态  是否支付成功
export const reqQueryPayStatus = (orderId) => ajax.get(`/payment/weixin/queryPayStatus/${orderId}`);

// 获取订单中心的数据
export const reqGetCenterListData = (page,limit)=> ajax.get(`/order/auth/${page}/${limit}`)